Skip to content

fix: score removed source files with tree diff#1271

Closed
DragunovX16 wants to merge 1 commit into
entrius:testfrom
DragunovX16:fix/issue-1268-removed-file-tree-diff
Closed

fix: score removed source files with tree diff#1271
DragunovX16 wants to merge 1 commit into
entrius:testfrom
DragunovX16:fix/issue-1268-removed-file-tree-diff

Conversation

@DragunovX16
Copy link
Copy Markdown

Summary

  • Route removed source files with available base content through tree-diff scoring instead of skipping before content lookup.
  • Preserve skip behavior for removed non-code files, missing base content, oversized files, and unsupported extensions.
  • Add pipeline-level regression coverage for removed source files with and without old content.

Related Issues

Fixes #1268

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated
  • Manually tested

Commands run:

.venv312/bin/python -m pytest tests/validator/test_token_scoring_integration.py -q
.venv312/bin/python -m ruff check gittensor/validator/utils/tree_sitter_scoring.py tests/validator/test_token_scoring_integration.py
.venv312/bin/python -m ruff format --check gittensor/validator/utils/tree_sitter_scoring.py tests/validator/test_token_scoring_integration.py

Note: uv run pytest tests/validator/test_token_scoring_integration.py -q could not complete in this workspace because uv selected Python 3.14 and failed building bittensor-wallet while bootstrapping Rust/cargo.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 14, 2026
@anderdc
Copy link
Copy Markdown
Collaborator

anderdc commented May 22, 2026

The removed → skipped branch is load-bearing — it dedups add+remove pairs. Once removed files are scored, a file move that GitHub splits into removed old/path + added new/path (any rename below the GitHub similarity threshold, trivially forced by editing the moved file) scores both sides: full deletion score plus full addition score, roughly 2x a file AST for code that was only moved, never authored. The scorer has no rename-pair dedup. The whole-file-deletion cliff is real, but scoring removed files without first collapsing rename pairs is net-negative. Closing.

@anderdc anderdc closed this May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Removed source files are skipped before tree-diff can score deletions

2 participants